Skip to content

Use Rector to upgrade codebase to PHP 8.4 #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
May 28, 2025
Merged

Use Rector to upgrade codebase to PHP 8.4 #77

merged 33 commits into from
May 28, 2025

Conversation

koriym
Copy link
Member

@koriym koriym commented May 28, 2025

This update includes:

  • Codebase refactored with Rector to utilize PHP 8.4 native features (such as readonly properties and #[Override] attributes)
  • PHPUnit upgraded to v12 for compatibility with PHP 8.4
  • Psalm configured to check for correct usage of #[Override] attributes

Summary by Sourcery

Upgrade the codebase to PHP 8.4 using Rector, refactor to leverage native language features, update dependencies, CI workflows, and documentation.

New Features:

  • Introduce rector.php configuration to automate code modernization to PHP 8.4

Enhancements:

  • Refactor core classes to use PHP 8.4 features (readonly classes, typed properties, typed constants, and Attributes such as Override and SensitiveParameter)
  • Simplify Injector instantiation syntax by removing redundant parentheses
  • Extend Pagerfanta support to include version 4

Build:

  • Add rector/rector and bump development tooling versions (phpunit ^12.1, phpmd 3.x-dev, pdepend, phpmetrics) in composer configurations

CI:

  • Update static-analysis workflow to exclude PHPMD and target PHP 8.4
  • Adjust continuous-integration workflow parameters to support PHP 8.4

Documentation:

  • Revise README with PHP ^8.4 requirements, installation instructions, and version compatibility table
  • Add UPGRADE.md to document the v1.x to v2.x upgrade path

Tests:

  • Migrate PHPUnit annotations to use PHP attributes (DataProvider, Depends) and update test code accordingly

Summary by Sourcery

Upgrade the codebase to PHP 8.4 by applying Rector transformations, refactoring core modules and examples to leverage native features and attributes, updating dependencies and CI workflows, and revising documentation and tests for full PHP 8.4 compatibility.

New Features:

  • Add rector.php configuration to automate code modernization to PHP 8.4
  • Extend Pagerfanta support to include version 4 through updated composer constraint

Enhancements:

  • Refactor classes to use PHP 8.4 features: readonly classes/properties, typed constants, and native attributes for DI, transactions, and overrides
  • Replace docblock annotations with PHP attributes (e.g., Named, Read, Transactional, DataProvider, Depends) across code and tests
  • Simplify injection and provider implementations by tightening type declarations, marking classes as final readonly, and using constructor injection in examples

Build:

  • Add Rector and bump development tooling versions (PHPUnit ^12.1, PHPStan, Psalm, PHPMD, PDepend, PHPMetrics) in composer configurations

CI:

  • Adjust static-analysis workflow to exclude PHPMD and target PHP 8.4
  • Update continuous-integration workflow parameters to support PHP 8.4

Documentation:

  • Revise README for PHP ^8.4 requirements, installation instructions, and usage examples
  • Add UPGRADE.md and CHANGELOG.md to document the v1.x to v2.x upgrade path and dependency changes

Tests:

  • Migrate PHPUnit annotations to PHP 8 attributes and update test code accordingly
  • Update tests to reflect simplified Injector instantiations and validate Pagerfanta v4 compatibility

Summary by CodeRabbit

  • New Features

    • Improved documentation with expanded and reorganized examples, including new sections on replication, pagination, and query builders.
    • Added a changelog entry for version 1.18.0, highlighting compatibility with PHP 8.4 and updated dependencies.
  • Enhancements

    • Many classes are now marked as final to improve reliability.
    • Sensitive parameters, such as database passwords, are explicitly marked to enhance security.
    • Enhanced type safety and added method override annotations across the codebase.
  • Bug Fixes

    • Updated workflow and dependency configurations to ensure compatibility with PHP 8.4 and modern testing tools.
  • Documentation

    • Refined README formatting, corrected terminology, and clarified usage instructions for better user guidance.
  • Chores

    • Updated development dependencies and static analysis tooling.
    • Modernized test syntax and configuration for improved maintainability.

koriym added 21 commits February 1, 2025 14:26
Added an empty array as the default value for the "old_stable" input parameter in the CI workflow. This ensures compatibility and prevents potential issues with missing parameters during pipeline execution.
Allowing compatibility with pagerfanta version 4.x ensures the project can leverage improvements and updates in the newer version while maintaining backward compatibility with 3.5. This change helps prepare the codebase for future updates.
This commit introduces the `#[Override]` attribute to mark methods that override parent or interface methods. This helps to improve code readability and clarity by explicitly indicating overridden methods, aligning with modern PHP practices.
Refactored several classes to be declared as final for better immutability and clarity. Introduced #[SensitiveParameter] attributes to secure sensitive fields such as passwords. Updated composer dependencies to include various library updates and improvements.
Removed the unused `old_stable` parameter from the CI workflow. This simplifies the configuration and ensures only the `current_stable` parameter is used.
Upgraded the PHPUnit version in require-dev from ^11.5.6 to ^12.1 to ensure compatibility with the latest features and improvements. This change helps maintain up-to-date testing tools for the project.
Refactor tests and improve type definitions: Replaced unnecessary parentheses in test instantiations for cleaner readability. Updated `readonly` keyword usage in providers and added `string` type to constants for stricter typing. Upgraded dependencies in `composer.lock` to align with newer framework versions for reliability and compatibility.
The Scrutinizer badge has been removed from the README file. This likely indicates it is no longer in use or relevant to the project. Other badges remain unchanged for status and coverage metrics.
Provide a comprehensive guide for upgrading Ray.AuraSqlModule to v2.x, addressing PHP 8.4+ compatibility and dependency changes. Clarifies no API changes were made and gives step-by-step migration instructions for developers.
Revised the README to reflect the new version 2.x, updated the compatibility table, and added details regarding requirements for PHP ^8.4 and Aura.Sql ^6.0. Replaced outdated CI badge with the new workflow link for better clarity.
This commit updates the copyright year in the LICENSE file from 2024 to 2025. This ensures the license remains accurate and up-to-date.
Removed the "DI trait" section, including references to `AuraSqlInject`. Consolidated documentation by focusing on replication setup with `AuraSqlReplicationModule`.
Introduce a `phpunit.xml` file to configure PHPUnit for the project, including test suite and coverage settings. Update `.gitignore` to reflect changes, replacing `.phpunit.result.cache` with `.phpunit.cache` for caching purposes.
This commit introduces a `rector.php` configuration file to enable automated code refactoring using Rector. It sets up paths for the `src` and `tests` directories, applies PHPUnit upgrade sets, and includes type coverage, dead code, and code quality settings.
Removed phpunit.xml in favor of phpunit.xml.dist to standardize configuration. Updated phpunit.xml.dist to use PHPUnit 11 schema and adjusted settings for coverage reporting and metadata requirements.
This change prevents unnecessary .phpunit.result.cache files from being tracked in the repository. It keeps the repository clean by ignoring test result cache files generated by PHPUnit.
Switch phpmd and pdepend to dev versions and add phpmetrics. This ensures compatibility with the latest features and prepares for upcoming changes in the tools ecosystem.
Adjust the static analysis workflow to use a version excluding PHPMD due to lack of PHP 8.4 support. This is a temporary change until PHPMD adds compatibility with PHP 8.4.
Copy link

coderabbitai bot commented May 28, 2025

"""

Walkthrough

This update introduces broad codebase refinements, including marking many classes as final and adding attribute annotations such as #[Override] and #[SensitiveParameter] for improved type safety and clarity. Documentation and workflow files are updated for PHP 8.4 compatibility, with dependency constraints and static analysis tooling revised accordingly. Test files adopt modern PHPUnit attribute syntax.

Changes

File(s) Change Summary
.github/workflows/continuous-integration.yml Changed current_stable input parameter value from numeric literal 8.4 to string literal "8.4".
.github/workflows/static-analysis.yml Renamed workflow to "Static Analysis (No PHPMD)", switched to a reusable workflow excluding PHPMD due to lack of PHP 8.4 support, added explanatory comment; PHP version remains 8.4.
.gitignore Reordered PHPUnit cache ignore entries, added /.phpunit.cache, moved /vendor-bin/tools/vendor/ entry before PHPUnit cache entries; no other path changes.
README.md Removed Scrutinizer badge, updated CI badge URL, reorganized installation and usage sections with proper code blocks, expanded and clarified documentation including replication, query builder, pagination, and profile sections; replaced annotations with PHP 8 attribute syntax; fixed typos and formatting; improved example code clarity and completeness.
composer.json Expanded pagerfanta/pagerfanta version constraint to `^3.5
phpunit.xml.dist Upgraded PHPUnit XML schema to 12.0, added requireCoverageMetadata="false", added <source> element for src directory, restructured <coverage> with nested <report> elements for HTML and text output, removed processUncoveredFiles attribute.
rector.php Added Rector configuration file enabling PHPUnit sets for versions 9.0, 10.0, and 11.0; set type coverage, dead code, and quality levels to zero; directories /src, /src-files, and /tests included for analysis.
CHANGELOG.md Added version 1.18.0 entry noting Aura.Sql upgrade from 5.x to 6.x for PHP 8.4 compatibility, internal PDO handling improvements, and backward compatibility maintained for PHP 8.1–8.3 with Aura.Sql v5.
vendor-bin/tools/composer.json Updated dependencies: upgraded doctrine/coding-standard to ^13.0.1, removed phpmd/phpmd, upgraded squizlabs/php_codesniffer to ^3.13, added rector/rector at ^2.0.16; vimeo/psalm unchanged but trailing comma added.
src/… (all PHP source files except exceptions and Pagerfanta) Marked many classes as final (some also readonly), added #[Override] attribute to overridden methods, added #[SensitiveParameter] to password parameters, explicitly typed constants, changed constructor property promotion from readonly to mutable where appropriate, imported Override and SensitiveParameter attributes as needed; no logic or control flow changes.
src/Exception/InvalidTransactionalPropertyException.php,
src/Exception/NotInitialized.php,
src/Exception/RollbackException.php
Changed exception classes to final.
src/Pagerfanta/… (all Pagerfanta-related classes) Marked classes as final (some also readonly), added #[Override] to interface-implementing and overridden methods, updated constructor property promotion from readonly to mutable, imported Override attribute where needed; no logic or control flow changes.
tests/… (all test files) Replaced PHPUnit annotation comments (@depends, @dataProvider) with PHP 8 attribute syntax (#[Depends], #[DataProvider]), removed unnecessary parentheses around object instantiations before method calls, minor syntax cleanups; no logic or behavior changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ModuleClass
    participant ParentModule

    User->>ModuleClass: Instantiate (with parameters)
    ModuleClass->>ModuleClass: Constructor (possibly #[SensitiveParameter])
    User->>ModuleClass: Call configure()
    ModuleClass->>ParentModule: #[Override] configure()
    Note right of ModuleClass: Class is final (cannot be subclassed)
Loading

Possibly related PRs

  • ray-di/Ray.AuraSqlModule#75: Modifies the same CI workflow inputs as this PR, but in the opposite direction—removing old_stable and updating current_stable—indicating a direct relationship in CI configuration evolution.

Poem

A rabbit hopped through code so bright,
Marked classes final—no subclass in sight!
With attributes new, and tests so neat,
PHP 8.4 support is now complete.
CI flows and docs aligned with care,
This codebase shines—beyond compare!
🐇✨
"""


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

sourcery-ai bot commented May 28, 2025

Reviewer's Guide

This PR uses Rector to automate migration to PHP 8.4 across source, test, docs, and tooling; it refactors classes to leverage readonly and attribute syntax, updates dependencies (PHPUnit 12, Pagerfanta v4), adjusts CI workflows for PHP 8.4, and modernizes documentation and tests accordingly.

Updated Class Diagram: AuraSqlModule with final, readonly properties, and PHP 8.4 Attributes

classDiagram
  direction LR
  class AuraSqlModule {
    +<<final>>
    +string PARSE_PDO_DSN_REGEX
    -readonly string dsn
    -readonly string user
    -readonly string password #[SensitiveParameter]
    -readonly string slave
    -readonly array options
    -readonly array queries
    +__construct(string dsn, string user, #[SensitiveParameter] string password, string slave, array options, array queries)
    +#[Override] configure() void
  }
  AuraSqlModule --|> AbstractModule
Loading

File-Level Changes

Change Details Files
Adopt PHP 8.4 features across codebase
  • Mark classes readonly and add typed constants/property declarations
  • Replace docblock annotations with PHP attributes (e.g. Override, DataProvider, Depends, SensitiveParameter)
  • Convert annotation-driven dependency injection and interceptors to use attributes
  • Simplify syntax by removing redundant parentheses
src/**.php
tests/**.php
Integrate Rector for automated code modernization
  • Add rector.php configuration with PHPUnit sets and code-quality settings
  • Include rector/rector in vendor-bin tools composer configuration
rector.php
vendor-bin/tools/composer.json
Update composer dependencies and tooling
  • Bump phpunit to ^12.1, add support for Pagerfanta v4.7
  • Upgrade doctrine coding standard, PHPStan, Psalm, PHPMD, PHPCS
  • Extend Pagerfanta dependency constraint to ^3.5
Revise CI workflows for PHP 8.4 compatibility
  • Exclude PHPMD from static-analysis job and target PHP 8.4
  • Adjust continuous-integration workflow parameters to use new stable version
.github/workflows/static-analysis.yml
.github/workflows/continuous-integration.yml
Modernize documentation and examples
  • Update README with PHP ^8.4 requirements, composer usage, and new sections (Replication, Pagination)
  • Add CHANGELOG.md and UPGRADE.md for upgrade guidance
  • Fix formatting, update badges, and reorganize code samples
README.md
CHANGELOG.md
UPGRADE.md
Migrate tests to use PHP attributes and new syntax
  • Replace @dataProvider and @Depends annotations with #[DataProvider] and #[Depends]
  • Instantiate Injector without extra parentheses
  • Adjust test imports and trait usages to attribute-based injection
tests/**/*.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (1)
src/NamedExtendedPdoProvider.php (1)

22-26: 🛠️ Refactor suggestion

Add type declarations to setContext to satisfy interface contract
With #[Override] and declare(strict_types=1), the signature should exactly match SetContextInterface::setContext(string $context): void. Update as follows:

-    #[Override]
-    public function setContext($context)
-    {
-        $this->context = $context;
-    }
+    #[Override]
+    public function setContext(string $context): void
+    {
+        $this->context = $context;
+    }
🧹 Nitpick comments (2)
rector.php (1)

23-25: Consider enabling code quality improvements.

While disabling automatic refactoring levels provides control, consider gradually enabling withCodeQualityLevel() to benefit from Rector's code improvement suggestions, especially for a modernization effort.

-    ->withTypeCoverageLevel(0)
-    ->withDeadCodeLevel(0)
-    ->withCodeQualityLevel(0);
+    ->withTypeCoverageLevel(0)
+    ->withDeadCodeLevel(0)
+    ->withCodeQualityLevel(1); // Start with level 1 for basic improvements
src/AuraSqlQuerySelectProvider.php (1)

21-21: Minor inconsistency in annotation usage.

The #[AuraSqlQueryConfig()] has empty parentheses here, while other provider classes use #[AuraSqlQueryConfig] without parentheses. Consider removing the empty parentheses for consistency.

-    #[AuraSqlQueryConfig()]
+    #[AuraSqlQueryConfig]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d39e48 and 8254eba.

⛔ Files ignored due to path filters (1)
  • vendor-bin/tools/composer.lock is excluded by !**/*.lock
📒 Files selected for processing (60)
  • .github/workflows/continuous-integration.yml (1 hunks)
  • .github/workflows/static-analysis.yml (2 hunks)
  • .gitignore (1 hunks)
  • LICENSE (1 hunks)
  • README.md (3 hunks)
  • UPGRADE.md (1 hunks)
  • composer.json (1 hunks)
  • phpunit.xml.dist (1 hunks)
  • rector.php (1 hunks)
  • src/AuraSqlBaseModule.php (2 hunks)
  • src/AuraSqlConnectionInterceptor.php (1 hunks)
  • src/AuraSqlEnvModule.php (2 hunks)
  • src/AuraSqlLocatorModule.php (3 hunks)
  • src/AuraSqlMasterDbInterceptor.php (1 hunks)
  • src/AuraSqlMasterModule.php (3 hunks)
  • src/AuraSqlModule.php (3 hunks)
  • src/AuraSqlProfileModule.php (1 hunks)
  • src/AuraSqlQueryDeleteProvider.php (1 hunks)
  • src/AuraSqlQueryInsertProvider.php (1 hunks)
  • src/AuraSqlQueryModule.php (2 hunks)
  • src/AuraSqlQuerySelectProvider.php (1 hunks)
  • src/AuraSqlQueryUpdateProvider.php (1 hunks)
  • src/AuraSqlReplicationDbProvider.php (3 hunks)
  • src/AuraSqlReplicationModule.php (2 hunks)
  • src/AuraSqlSlaveDbInterceptor.php (1 hunks)
  • src/Connection.php (2 hunks)
  • src/EnvConnection.php (2 hunks)
  • src/Exception/InvalidTransactionalPropertyException.php (1 hunks)
  • src/Exception/NotInitialized.php (1 hunks)
  • src/Exception/RollbackException.php (1 hunks)
  • src/IsInMethodMatcher.php (3 hunks)
  • src/NamedExtendedPdoProvider.php (2 hunks)
  • src/NamedPdoEnvModule.php (2 hunks)
  • src/NamedPdoModule.php (3 hunks)
  • src/Pagerfanta/AuraSqlPager.php (7 hunks)
  • src/Pagerfanta/AuraSqlPagerFactory.php (1 hunks)
  • src/Pagerfanta/AuraSqlPagerModule.php (1 hunks)
  • src/Pagerfanta/AuraSqlQueryAdapter.php (4 hunks)
  • src/Pagerfanta/AuraSqlQueryPager.php (7 hunks)
  • src/Pagerfanta/AuraSqlQueryPagerFactory.php (1 hunks)
  • src/Pagerfanta/DefaultRouteGenerator.php (1 hunks)
  • src/Pagerfanta/ExtendedPdoAdapter.php (4 hunks)
  • src/Pagerfanta/FetchAssoc.php (2 hunks)
  • src/Pagerfanta/FetchEntity.php (2 hunks)
  • src/Pagerfanta/Page.php (3 hunks)
  • src/ProfilerProvider.php (1 hunks)
  • src/TransactionalInterceptor.php (2 hunks)
  • src/TransactionalModule.php (1 hunks)
  • tests/AuraSqlLocatorModuleTest.php (1 hunks)
  • tests/AuraSqlModuleTest.php (2 hunks)
  • tests/AuraSqlProfileModuleTest.php (2 hunks)
  • tests/AuraSqlQueryModuleTest.php (1 hunks)
  • tests/AuraSqlReplicationModuleTest.php (3 hunks)
  • tests/NamedPdoEnvModuleTest.php (1 hunks)
  • tests/NamedPdoModuleTest.php (3 hunks)
  • tests/Pagerfanta/AuraSqlPagerModuleTest.php (7 hunks)
  • tests/Pagerfanta/AuraSqlQueryPagerModuleTest.php (6 hunks)
  • tests/Pagerfanta/ExtendedPdoAdapterTest.php (2 hunks)
  • tests/TransactionalTest.php (3 hunks)
  • vendor-bin/tools/composer.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (10)
tests/NamedPdoModuleTest.php (4)
src/NamedPdoModule.php (1)
  • NamedPdoModule (14-80)
tests/Fake/FakeNamedReplicationModule.php (1)
  • FakeNamedReplicationModule (7-18)
tests/AuraSqlModuleTest.php (1)
  • getDsn (74-81)
tests/Fake/FakeNamedQualifierModule.php (1)
  • FakeNamedQualifierModule (7-16)
tests/AuraSqlReplicationModuleTest.php (2)
src/AuraSqlReplicationModule.php (1)
  • AuraSqlReplicationModule (15-60)
tests/Fake/FakeRepModel.php (1)
  • FakeRepModel (8-19)
src/AuraSqlEnvModule.php (3)
src/AuraSqlModule.php (1)
  • Override (41-46)
src/NamedPdoEnvModule.php (1)
  • Override (39-44)
src/NamedPdoModule.php (1)
  • Override (43-48)
tests/AuraSqlModuleTest.php (3)
src/AuraSqlModule.php (1)
  • AuraSqlModule (14-74)
tests/Fake/FakeQueryInject.php (2)
  • FakeQueryInject (7-34)
  • get (24-33)
tests/Fake/FakeQualifierModule.php (1)
  • FakeQualifierModule (7-16)
src/AuraSqlQueryInsertProvider.php (5)
src/AuraSqlQueryDeleteProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQuerySelectProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQueryUpdateProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQueryModule.php (2)
  • Override (25-33)
  • __construct (17-20)
src/Annotation/AuraSqlQueryConfig.php (1)
  • __construct (23-25)
src/AuraSqlSlaveDbInterceptor.php (6)
src/AuraSqlConnectionInterceptor.php (2)
  • Override (33-43)
  • __construct (22-28)
src/AuraSqlQueryDeleteProvider.php (1)
  • Override (29-33)
src/AuraSqlMasterDbInterceptor.php (2)
  • Override (24-34)
  • __construct (17-19)
src/AuraSqlQueryInsertProvider.php (1)
  • Override (29-33)
src/AuraSqlQuerySelectProvider.php (1)
  • Override (29-33)
src/AuraSqlReplicationModule.php (1)
  • __construct (17-23)
src/NamedPdoEnvModule.php (13)
src/AuraSqlConnectionInterceptor.php (1)
  • Override (33-43)
src/AuraSqlQueryDeleteProvider.php (1)
  • Override (29-33)
src/AuraSqlMasterDbInterceptor.php (1)
  • Override (24-34)
src/AuraSqlModule.php (1)
  • Override (41-46)
src/AuraSqlQueryInsertProvider.php (1)
  • Override (29-33)
src/AuraSqlQuerySelectProvider.php (1)
  • Override (29-33)
src/AuraSqlQueryUpdateProvider.php (1)
  • Override (29-33)
src/AuraSqlSlaveDbInterceptor.php (1)
  • Override (27-37)
src/Pagerfanta/DefaultRouteGenerator.php (1)
  • Override (18-22)
src/ProfilerProvider.php (1)
  • Override (18-26)
src/NamedPdoModule.php (1)
  • Override (43-48)
src/AuraSqlMasterModule.php (1)
  • Override (37-49)
src/NamedExtendedPdoProvider.php (2)
  • Override (22-26)
  • Override (35-41)
tests/Pagerfanta/AuraSqlPagerModuleTest.php (3)
src/Pagerfanta/AuraSqlPagerModule.php (1)
  • AuraSqlPagerModule (15-31)
src/AuraSqlModule.php (1)
  • AuraSqlModule (14-74)
tests/Fake/FakePagerInject.php (1)
  • FakePagerInject (5-17)
src/AuraSqlQuerySelectProvider.php (5)
src/AuraSqlQueryDeleteProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQueryInsertProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQueryUpdateProvider.php (2)
  • Override (29-33)
  • AuraSqlQueryConfig (21-24)
src/AuraSqlQueryModule.php (2)
  • Override (25-33)
  • __construct (17-20)
src/Annotation/AuraSqlQueryConfig.php (1)
  • __construct (23-25)
src/NamedExtendedPdoProvider.php (4)
src/AuraSqlConnectionInterceptor.php (1)
  • Override (33-43)
src/NamedPdoEnvModule.php (1)
  • Override (39-44)
src/TransactionalInterceptor.php (1)
  • Override (26-50)
src/AuraSqlReplicationDbProvider.php (2)
  • Override (28-32)
  • Override (37-44)
🪛 PHPStan (2.1.15)
src/AuraSqlSlaveDbInterceptor.php

18-18: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

src/NamedPdoEnvModule.php

13-13: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

src/AuraSqlMasterDbInterceptor.php

15-15: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

src/AuraSqlModule.php

16-16: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

src/NamedPdoModule.php

16-16: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

src/AuraSqlConnectionInterceptor.php

19-19: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

🪛 LanguageTool
UPGRADE.md

[uncategorized] ~57-~57: A punctuation mark might be missing here.
Context: ...-----|-------------|----------|--------| | v1.x | ^8.1 | ^5.0...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


[style] ~69-~69: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...* All public APIs and interfaces remain exactly the same. #### Q: Why the major version bump? *...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[style] ~86-~86: Consider using a different verb to strengthen your wording.
Context: ...ray-di/Ray.AuraSqlModule/issues) if you find any problems ### Technical Details Th...

(FIND_ENCOUNTER)


[uncategorized] ~90-~90: You might be missing the article “the” here.
Context: ...roduced in PHP 8.4. The underlying Aura.Sql library handles these changes transpare...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

README.md

[uncategorized] ~24-~24: A punctuation mark might be missing here.
Context: ...| PHP | Aura.Sql | Branch | Status | |---------|---------|----------|--------...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

🔇 Additional comments (160)
src/EnvConnection.php (2)

8-8: LGTM: Appropriate import for security enhancement.

The SensitiveParameter import is correctly added to support the new attribute usage below.


29-30: Excellent security enhancement with #[SensitiveParameter].

The #[SensitiveParameter] attribute is correctly applied to the password parameter. This PHP 8.2+ feature ensures that sensitive data like passwords are redacted from stack traces and error reports, preventing accidental exposure of credentials in logs or debugging output.

This change aligns perfectly with the PR's security improvements and PHP 8.4 modernization goals.

src/Connection.php (3)

8-8: LGTM! Necessary import for security enhancement.

The addition of the SensitiveParameter import is required to support the #[SensitiveParameter] attribute usage on the password parameter, which is an excellent security improvement.


10-10: Approve the final class declaration for improved security.

Making the Connection class final is a good design decision that:

  • Prevents unintended inheritance and potential security vulnerabilities
  • Provides clearer API boundaries
  • Allows for better PHP engine optimizations

This is an appropriate breaking change for a major version upgrade (2.x).


21-22: Excellent security enhancement with SensitiveParameter attribute.

The addition of #[SensitiveParameter] to the password parameter is a significant security improvement that:

  • Prevents password values from appearing in stack traces
  • Redacts sensitive data in debugging output and var_dump()
  • Enhances overall security posture of the application

This follows PHP 8.2+ best practices for handling sensitive data and aligns perfectly with the modernization goals of this PR.

src/NamedExtendedPdoProvider.php (2)

15-15: Final class declaration aligns with project conventions
Marking provider classes as final enforces immutability and prevents unintended extension, matching the updates in other modules.


35-41: Override annotation on get method is correct
The get(): ExtendedPdo signature adheres to the generic ProviderInterface<ExtendedPdo> contract, and marking it with #[Override] enhances clarity and Psalm verification.

src/IsInMethodMatcher.php (4)

14-14: Consistent immutability: mark class as final
Marking IsInMethodMatcher as final enforces immutability and signals the class isn’t intended for extension, aligning with the PHP 8.4 modernization strategy.


24-24: Annotate matchesClass with #[Override]
Adding the Override attribute makes it explicit that this method overrides the parent declaration and works in concert with the updated Psalm configuration for attribute checks.


37-37: Annotate matchesMethod with #[Override]
Similarly, this attribute clarifies that matchesMethod is an override, improving readability and static-analysis accuracy.


7-7:

❓ Verification inconclusive

Ensure correct import for Override attribute
The use Override; statement assumes there’s an attribute class named Override in the root namespace. Please confirm that the Override attribute is defined and autoloadable from this namespace, or adjust the import to its fully-qualified path.


🏁 Script executed:

#!/bin/bash
# Verify the existence of the Override attribute
rg --files-with-matches "class Override" -n .
rg --files-with-matches "interface Override" -n .

Length of output: 99


Ensure correct import for Override attribute
I couldn’t locate any class Override or interface Override definitions in the repository. Please verify that an Override attribute exists and is autoloadable (for example via Composer), or update the import to its full namespace.

  • src/IsInMethodMatcher.php: line 7 (use Override;)
src/Exception/RollbackException.php (1)

9-9:

✅ Verification successful

Approve final class enforcement Marking RollbackException as final aligns with the PR’s modernization goals to prevent subclassing and improve immutability.

Run this script to verify no unintended subclasses exist in the codebase:


🏁 Script executed:

#!/bin/bash
# Verify no classes extend RollbackException
rg -n "extends\s\+RollbackException"

Length of output: 38


🏁 Script executed:

#!/bin/bash
# Robust search for any subclasses of RollbackException
rg -n "class\s\+\w\+\s\+extends\s\+.*RollbackException"
rg -n "extends\s\+.*RollbackException"

Length of output: 98


Approve final class enforcement
Marking RollbackException as final aligns with the PR’s modernization goals to prevent subclassing and improve immutability.

• Verified no subclasses exist by running:

  • rg -n "class\s\+\w\+\s\+extends\s\+.*RollbackException"
  • rg -n "extends\s\+.*RollbackException"
    No matches found, confirming it’s safe to seal this class.
src/Exception/InvalidTransactionalPropertyException.php (1)

9-9:

✅ Verification successful

Approve final class enforcement Declaring InvalidTransactionalPropertyException as final is consistent with the shift towards immutability and preventing unintended inheritance.

Use this script to confirm there are no subclasses extending it:


🏁 Script executed:

#!/bin/bash
# Verify no classes extend InvalidTransactionalPropertyException
rg -n "extends\s\+InvalidTransactionalPropertyException"

Length of output: 58


🏁 Script executed:

#!/bin/bash
# Verify no classes extend InvalidTransactionalPropertyException (direct or namespaced)
rg -n 'extends\s+InvalidTransactionalPropertyException'
rg -n 'extends\s+\\?[\w\\]*InvalidTransactionalPropertyException'

Length of output: 125


Approve final class enforcement
Ran rg -n 'extends\s+InvalidTransactionalPropertyException' (including namespaced variants); no subclasses found. Declaring InvalidTransactionalPropertyException as final is safe and requires no further changes.

src/Exception/NotInitialized.php (1)

9-9:

✅ Verification successful

Approve final class enforcement Making NotInitialized a final class fits the pattern of locking down exception hierarchies for clarity and immutability.

Validate absence of subclasses with:


🏁 Script executed:

#!/bin/bash
# Verify no classes extend NotInitialized
rg -n "extends\s\+NotInitialized"

Length of output: 35


To ensure we catch any subclass definitions—regardless of namespace or alias—let’s run a broader search:


🏁 Script executed:

#!/bin/bash
# 1. Case-insensitive grep for any “extends …NotInitialized”
rg -in "extends\s+.*NotInitialized"

# 2. AST-based check for direct subclassing of NotInitialized
ast-grep --pattern $'class $_ extends NotInitialized { $$$ }'

Length of output: 100


Approve final class enforcement
Making NotInitialized a final class fits our pattern of locking down exception hierarchies for clarity and immutability. Verified via Ripgrep and AST-grep searches that no classes extend NotInitialized.

LICENSE (1)

3-3: LGTM! Standard copyright year update.

The copyright year has been appropriately updated to include 2025, which is a routine maintenance practice.

composer.json (1)

16-16: LGTM! Good backward compatibility for pagerfanta.

The expanded version constraint allows compatibility with both pagerfanta v3.5+ and v4.0+, providing good flexibility for downstream users.

src/AuraSqlQueryModule.php (3)

11-11: LGTM! Proper import for Override attribute.

The Override import is correctly added to support the #[Override] attribute usage.


15-15: LGTM! Making the class final improves encapsulation.

Declaring the module class as final prevents unintended inheritance and is a good practice for concrete module implementations.


25-25: LGTM! Correct usage of Override attribute.

The #[Override] attribute is properly applied to the configure() method which overrides AbstractModule::configure(). This provides compile-time verification and improves code clarity.

vendor-bin/tools/composer.json (2)

10-10: LGTM! Rector version is stable and appropriate.

The rector version ^2.0.16 is a stable release and aligns well with the PR's goal of using Rector for PHP 8.4 modernization.


4-6:

❓ Verification inconclusive

Consider using stable versions instead of dev/RC releases.

Using development and release candidate versions introduces potential instability:

  • phpmd/phpmd: "3.x-dev" - dev versions can change without notice
  • pdepend/pdepend: "3.x-dev" - same stability concern
  • phpmetrics/phpmetrics: "3.0.0-rc.8@RC" - release candidates may have bugs

Please verify if stable versions are available for PHP 8.4 compatibility:


🌐 Web query:

Are stable versions of phpmd/phpmd 3.x, pdepend/pdepend 3.x, and phpmetrics/phpmetrics 3.x available that support PHP 8.4?

💡 Result:

Based on the search results, I'll analyze the current status of these PHP static analysis tools and their compatibility with PHP 8.4.

PHPMD (PHP Mess Detector)

Currently, there is no stable version of PHPMD 3.x available. The latest stable release is PHPMD 2.15.0, which was released on December 11, 2023[3]. This version requires pdepend/pdepend 2.16.1, which includes support for PHP 8.3 syntax[3][8].

However, PHPMD is facing compatibility issues with PHP 8.4. There's an open issue (#1219) specifically about PHP 8.4 support, where users are encountering errors like "Unexpected token: ->" when using PHPMD with PHP 8.4[1]. A user in this issue mentioned that using the development version 3.x-dev appears to work with PHP 8.4, but there's no stable 3.x release yet[1].

PDepend

For PDepend, the latest stable release is version 2.16.2[10]. There's no indication in the search results of a stable 3.x version being available. PDepend 2.16.1 added support for PHP 8.3 syntax[3][8], but there's no explicit mention of PHP 8.4 support in the most recent stable release (2.16.2).

PhpMetrics

PhpMetrics has a version 3.0 in development, but it's currently in release candidate status (up to rc8 as of the search results). The most recent release candidate mentioned is v3.0.0-rc7, released on February 4, 2025[7]. This version requires PHP 8.1 minimum[7], but there's no specific mention of PHP 8.4 compatibility in the search results.

Summary

None of these tools currently have stable 3.x versions that explicitly support PHP 8.4:

  1. PHPMD: No stable 3.x version, though 3.x-dev might work with PHP 8.4 based on user comments
  2. PDepend: No stable 3.x version, latest is 2.16.2 with PHP 8.3 support
  3. PhpMetrics: Version 3.0 is in release candidate status (not stable), requires PHP 8.1+ but no explicit mention of PHP 8.4 compatibility

If you need to use these tools with PHP 8.4, you might need to wait for stable releases or use development versions with caution.

Citations:


Review stability of static analysis dependencies

The requested 3.x/RC releases are not yet stable or officially supporting PHP 8.4:

  • phpmd/phpmd: currently no stable 3.x release (latest stable 2.15.0 supports PHP 8.3; see issue #1219 for PHP 8.4 errors)
  • pdepend/pdepend: no stable 3.x release (latest stable 2.16.2 supports PHP 8.3)
  • phpmetrics/phpmetrics: only RC available (3.0.0-rc.8; requires PHP 8.1+, no explicit PHP 8.4 support)

Recommendations:

  • If you need maximum stability, pin to the latest stable releases:
    - "phpmd/phpmd": "3.x-dev"
    + "phpmd/phpmd": "^2.15"
    
    - "pdepend/pdepend": "3.x-dev"
    + "pdepend/pdepend": "^2.16"
  • If PHP 8.4 compatibility is critical today, you may proceed with the dev/RC versions but ensure CI/tests cover these tools and plan to upgrade once stable 3.x releases are published.
.gitignore (1)

8-10: LGTM! Clean reorganization of ignore patterns.

The reorganization groups PHPUnit cache files together and properly positions the vendor directory entry. This aligns well with the tooling updates mentioned in the PR.

src/AuraSqlProfileModule.php (3)

8-8: Good addition of Override import.

Properly imported the Override attribute for the method annotation below.


11-11: Excellent use of final keyword.

Making the class final prevents unintended inheritance and clearly communicates the design intent. This is a good modernization practice.


16-16: Great use of #[Override] attribute.

The #[Override] attribute provides compile-time safety by ensuring this method actually overrides a parent method, and serves as clear documentation of the intent.

src/AuraSqlModule.php (5)

9-12: Good addition of necessary imports.

Properly imported the Override and SensitiveParameter attributes for use in the class.


14-14: Excellent use of final keyword.

Making the main module class final prevents unintended inheritance and clearly communicates the design intent.


16-16: Good modernization with typed constant.

The explicitly typed constant improves type safety. Note that this feature requires PHP 8.3+, which aligns with your PHP 8.4 target.

🧰 Tools
🪛 PHPStan (2.1.15)

16-16: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)


29-30: Excellent security enhancement with #[SensitiveParameter].

Adding the #[SensitiveParameter] attribute to the password parameter is a great security practice. This prevents the password from appearing in stack traces and debug output, reducing the risk of accidental exposure of sensitive data.


41-41: Great use of #[Override] attribute.

The #[Override] attribute provides compile-time safety and clear documentation that this method overrides a parent method.

src/Pagerfanta/FetchAssoc.php (2)

8-8: Good addition of Override import.

Properly imported the Override attribute for the method annotation.


20-20: Excellent use of #[Override] attribute.

Adding the #[Override] attribute to the __invoke method provides compile-time safety by ensuring it properly implements the interface method, and serves as clear documentation.

tests/NamedPdoModuleTest.php (4)

20-20: LGTM: Syntactic improvement removing unnecessary parentheses.

The removal of parentheses around the Injector instantiation improves code readability while maintaining the same functionality.


37-37: LGTM: Consistent syntactic improvement.

The change aligns with the modernization effort and removes unnecessary parentheses without affecting behavior.


47-47: LGTM: Code readability improvement.

The simplified syntax is more readable and consistent with modern PHP conventions.


55-55: LGTM: Consistent refactoring pattern.

This change maintains consistency with the other similar refactoring changes in the file.

tests/NamedPdoEnvModuleTest.php (3)

24-24: LGTM: Syntactic simplification in test method.

The removal of unnecessary parentheses around Injector instantiation improves code readability while maintaining functionality.


31-31: LGTM: Consistent refactoring pattern.

This change aligns with the project-wide effort to modernize syntax and improve readability.


38-38: LGTM: Code modernization improvement.

The simplified syntax is cleaner and follows modern PHP conventions.

tests/AuraSqlQueryModuleTest.php (1)

57-57: LGTM: Syntactic improvement removing unnecessary parentheses.

The change simplifies the Injector instantiation syntax while maintaining the same functionality, improving code readability.

tests/AuraSqlLocatorModuleTest.php (1)

34-34: LGTM: Consistent syntactic modernization.

The removal of unnecessary parentheses around Injector instantiation in the setUp method improves readability and aligns with the project-wide refactoring effort.

tests/Pagerfanta/AuraSqlQueryPagerModuleTest.php (3)

8-8: LGTM: Proper PHPUnit 11 modernization

The import of PHPUnit\Framework\Attributes\Depends is correctly added to support the new attribute syntax for test dependencies.


17-17: LGTM: Code cleanup improves readability

Removing unnecessary parentheses around the new Injector(...) expressions improves code readability while maintaining the same functionality.

Also applies to: 29-29


38-38: LGTM: Proper migration to PHP 8 attributes

The replacement of PHPUnit @depends docblock annotations with #[Depends()] attributes is correct and aligns with PHPUnit 11 modernization. This syntax is more explicit and provides better IDE support and static analysis.

Also applies to: 58-58, 78-78, 86-86

src/AuraSqlLocatorModule.php (3)

8-8: LGTM: Required import for #[Override] attribute

The Override import is correctly added to support the PHP 8 #[Override] attribute syntax.


18-18: LGTM: Appropriate final class declaration

Marking the AuraSqlLocatorModule class as final is appropriate as it appears to be a concrete module implementation that should not be further extended. This aligns with the modernization goals and improves code safety.


38-38: LGTM: Proper use of #[Override] attribute

The #[Override] attribute is correctly applied to the configure() method, which overrides the abstract method from AbstractModule. This provides explicit documentation of the override relationship and enables static analysis tools like Psalm to verify the override is valid.

src/Pagerfanta/Page.php (3)

9-9: LGTM: Required import for #[Override] attribute

The Override import is correctly added to support the PHP 8 #[Override] attribute syntax.


53-53: LGTM: Proper #[Override] for interface implementation

The #[Override] attribute is correctly applied to the __toString() method, which implements the Stringable::__toString() interface method. This provides explicit documentation and static analysis verification.


68-68: LGTM: Proper #[Override] for interface implementation

The #[Override] attribute is correctly applied to the getIterator() method, which implements the IteratorAggregate::getIterator() interface method. This enhances code clarity and enables static analysis tools to verify the implementation.

src/AuraSqlEnvModule.php (3)

7-7: LGTM: Required import for #[Override] attribute

The Override import is correctly added to support the PHP 8 #[Override] attribute syntax.


10-10: LGTM: Appropriate final class declaration

Marking the AuraSqlEnvModule class as final is appropriate as it's a concrete module implementation that should not be further extended. This aligns with the modernization pattern seen across other modules in the codebase.


34-34: LGTM: Proper use of #[Override] attribute

The #[Override] attribute is correctly applied to the configure() method, which overrides the abstract method from AbstractModule. This is consistent with the pattern shown in the relevant code snippets from other modules like AuraSqlModule, NamedPdoModule, and NamedPdoEnvModule.

tests/TransactionalTest.php (1)

16-16: LGTM! Style improvement for object instantiation.

The removal of unnecessary parentheses around new Injector(...) instantiations improves code readability while maintaining identical functionality. This follows modern PHP style conventions.

Also applies to: 52-52, 87-87

src/AuraSqlReplicationModule.php (3)

9-9: LGTM! Proper import for Override attribute.

Adding the use Override; statement is correctly placed and necessary for the #[Override] attribute usage below.


15-15: LGTM! Making class final improves design clarity.

Marking the class as final prevents subclassing, which enhances performance and clearly communicates the design intent that this module shouldn't be extended.


28-28: LGTM! Override attribute improves type safety.

The #[Override] attribute provides compile-time verification that this method actually overrides a parent method, helping catch potential issues during refactoring.

.github/workflows/continuous-integration.yml (1)

12-13: LGTM! CI configuration updated for PHP 8.4 support.

The workflow parameters are correctly configured to support PHP 8.4 as the current stable version, with appropriate JSON formatting for the old_stable parameter and string formatting for current_stable.

tests/AuraSqlModuleTest.php (1)

23-23: LGTM! Consistent style improvement across test methods.

The removal of unnecessary parentheses around object instantiations improves code readability and follows modern PHP conventions. All changes maintain identical functionality while improving consistency with the codebase style updates.

Also applies to: 29-30, 36-36, 43-43, 50-50, 69-69

src/TransactionalModule.php (3)

7-7: LGTM! Proper import for Override attribute.

The use Override; statement is correctly positioned and necessary for the #[Override] attribute used in the configure method.


11-11: LGTM! Final class declaration improves design.

Making the class final prevents unintended subclassing and clearly communicates the design intent, which is a good practice for module classes.


16-16: LGTM! Override attribute enhances type safety.

The #[Override] attribute provides compile-time verification that this method correctly overrides the parent class method, helping prevent errors during refactoring.

src/AuraSqlBaseModule.php (3)

7-7: LGTM: Override import added for PHP 8.3+ attribute support.

The import is correctly added to support the #[Override] attribute usage below.


13-13: LGTM: Class marked as final for improved immutability.

Making the class final prevents subclassing, which improves performance and ensures the intended design pattern. This aligns with the modernization effort in the codebase.


23-24: LGTM: Override attribute improves method override clarity.

The #[Override] attribute explicitly marks this method as overriding a parent method, providing better IDE support and compile-time checks if the parent signature changes.

tests/AuraSqlProfileModuleTest.php (3)

8-8: LGTM: PHPUnit attribute import added for modern test syntax.

The import enables the use of PHP 8 attributes for test dependencies, replacing docblock annotations.


50-50: LGTM: Simplified Injector instantiation syntax.

Removing unnecessary parentheses improves code readability without changing functionality.


56-56: LGTM: Modernized test dependency syntax with PHP 8 attributes.

The #[Depends('testModule')] attribute replaces the @depends docblock annotation, providing better IDE support and type safety in PHPUnit 10+.

src/ProfilerProvider.php (4)

8-8: LGTM: Override import added for attribute support.

The import enables the use of the #[Override] attribute below.


12-12: LGTM: Class marked as final readonly for improved immutability.

The final readonly declaration prevents subclassing and ensures all properties are immutable, enhancing security and performance.


14-14: LGTM: Removed redundant readonly from constructor parameter.

Since the class is declared readonly, all properties are automatically readonly, making the explicit readonly keyword on constructor parameters redundant.


18-19: LGTM: Override attribute improves method documentation.

The #[Override] attribute explicitly marks this method as implementing the Provider interface, providing better IDE support and compile-time validation.

src/AuraSqlReplicationDbProvider.php (4)

9-9: LGTM: Override import added for attribute support.

The import enables the use of the #[Override] attribute on interface method implementations.


15-15: LGTM: Class marked as final for improved design clarity.

Making the class final prevents subclassing, ensuring the intended provider pattern and improving performance.


28-29: LGTM: Override attribute on SetContextInterface implementation.

The #[Override] attribute explicitly marks this method as implementing the SetContextInterface, providing better IDE support and validation.


37-38: LGTM: Override attribute on ProviderInterface implementation.

The #[Override] attribute explicitly marks this method as implementing the ProviderInterface, ensuring compile-time validation and improving code documentation.

src/Pagerfanta/AuraSqlPagerModule.php (1)

7-7: LGTM! Excellent modernization with PHP 8.4 features.

The changes properly implement PHP 8.4 best practices:

  • Added use Override; import for the attribute
  • Made the class final to prevent subclassing and improve immutability
  • Added #[Override] attribute to explicitly mark method override

These changes enhance code clarity and align with the broader modernization effort across the codebase.

Also applies to: 15-15, 20-20

tests/AuraSqlReplicationModuleTest.php (3)

10-10: LGTM! Proper PHPUnit modernization.

Added the necessary import for PHPUnit attributes to support the modern attribute syntax.


32-32: LGTM! Excellent adoption of PHPUnit 11 attribute syntax.

Replaced the legacy docblock annotation syntax with modern PHP 8 attributes for data providers. This is the recommended approach in PHPUnit 11 and improves code consistency.

Also applies to: 43-43, 54-54


37-37: LGTM! Clean syntax improvements.

Removed unnecessary parentheses around new Injector(...) expressions, improving code readability while maintaining the same functionality.

Also applies to: 48-48, 63-64

src/NamedPdoEnvModule.php (2)

8-8: LGTM! Consistent modernization with PHP 8.4 features.

The changes follow the same modernization pattern:

  • Added use Override; import
  • Made the class final for better immutability
  • Added #[Override] attribute to explicitly mark method override

These changes are consistent with the codebase-wide modernization effort.

Also applies to: 11-11, 39-39


13-13:

✅ Verification successful

Verify PHP version compatibility for typed class constants.

The explicit string type on the class constant is a good practice, but static analysis indicates this feature requires PHP 8.3+. Since this PR targets PHP 8.4, this should be compatible, but please verify that the project's minimum PHP version supports this feature.


🏁 Script executed:

#!/bin/bash
# Description: Check the project's minimum PHP version requirement
# Expected: Should show PHP 8.4 as minimum version to confirm compatibility

# Check composer.json for PHP version requirements
cat composer.json | jq '.require.php'

# Check if there are any version constraints files
fd -t f 'composer.json' --exec cat {} \; | grep -E '"php":\s*"'

Length of output: 134


No action needed – PHP ^8.4 fully supports typed class constants

Your composer.json declares "php": "^8.4" and typed class constants (public const string …) have been supported since PHP 8.1, so this change is compatible.

🧰 Tools
🪛 PHPStan (2.1.15)

13-13: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)

.github/workflows/static-analysis.yml (1)

1-5: LGTM! Pragmatic temporary solution for PHP 8.4 compatibility.

The changes appropriately handle PHPMD's lack of PHP 8.4 support:

  • Clear documentation explaining why PHPMD is temporarily excluded
  • Updated workflow name to reflect the change
  • Switched to appropriate reusable workflow without PHPMD

This is a well-documented temporary workaround that maintains static analysis coverage while addressing compatibility constraints.

Also applies to: 14-14

phpunit.xml.dist (1)

2-5: PHPUnit configuration upgrade looks good.

The migration from PHPUnit 9.3 to 11.0 schema is correctly implemented with the new requireCoverageMetadata="false" attribute.

tests/Pagerfanta/ExtendedPdoAdapterTest.php (2)

8-8: Good modernization with PHPUnit attributes.

The import for PHPUnit\Framework\Attributes\DataProvider is correctly added to support the new attribute syntax.


80-81: Excellent migration to PHP 8 attributes.

The conversion from @dataProvider docblock annotation to #[DataProvider('splProvider')] attribute aligns with modern PHPUnit best practices and improves type safety.

src/Pagerfanta/AuraSqlQueryAdapter.php (3)

9-9: Good addition of Override import.

The import for the Override attribute supports the modernization to PHP 8.3+ features.


21-21: Excellent use of final keyword.

Making the class final is a good practice for concrete adapter implementations, preventing unintended inheritance and improving code safety.


38-38:

❓ Verification inconclusive

Verify #[Override] attribute usage for interface implementations.

The #[Override] attribute is correctly applied to methods implementing the AdapterInterface. This enhances code safety by ensuring these methods actually override/implement interface methods.

Also applies to: 58-58


🏁 Script executed:

#!/bin/bash
# Description: Verify that #[Override] is used correctly for interface implementations
# Expected: The methods should actually implement AdapterInterface methods

# Check the AdapterInterface definition
echo "Checking AdapterInterface methods:"
ast-grep --pattern 'interface AdapterInterface {
  $$$
  getNbResults($$$) $$$
  $$$
  getSlice($$$) $$$
  $$$
}'

# Check for other classes using #[Override] with this interface
echo "Other implementations of AdapterInterface with #[Override]:"
rg -A 2 -B 1 "#\[Override\]" --type php

Length of output: 11812


🏁 Script executed:

#!/bin/bash
# Locate and display the AdapterInterface definition along with its methods
rg -Hn "interface AdapterInterface" -C 5

Length of output: 42


Cannot Verify #[Override] Usage—AdapterInterface Not Found

I was unable to locate the AdapterInterface declaration in this repository (it’s likely coming from an external package). Please confirm that it defines:

  • getNbResults(): int
  • getSlice(int $offset, int $length): iterable

so that these two methods in src/Pagerfanta/AuraSqlQueryAdapter.php truly implement the interface and justify the #[Override] annotations.

rector.php (2)

16-22: PHPUnit upgrade sets are well configured.

The inclusion of PHPUnitSetList versions 9.0, 10.0, and 11.0 provides a comprehensive upgrade path that aligns with the project's PHPUnit modernization goals.


8-13:

✅ Verification successful

Verify configured paths exist.

The Rector configuration includes paths for src, src-files, and tests. Please ensure all these directories exist in the project structure.


🏁 Script executed:

#!/bin/bash
# Description: Verify that all configured Rector paths exist
# Expected: All directories should exist

echo "Checking configured Rector paths:"
for dir in "src" "src-files" "tests"; do
    if [ -d "$dir" ]; then
        echo "$dir directory exists"
    else
        echo "$dir directory missing"
    fi
done

Length of output: 433


Rector configuration – paths verified

All configured Rector paths exist in the project:

  • ✓ src
  • ✓ src-files
  • ✓ tests

The configuration structure looks good. You may still consider enabling some of Rector’s quality rule levels for deeper automated improvements.

src/AuraSqlMasterModule.php (4)

9-9: Excellent addition of modern PHP attributes.

The import statements for Override and SensitiveParameter attributes are properly added to support the new PHP 8.4 features used in this class.

Also applies to: 12-12


14-14: Good use of final keyword.

Making the class final prevents unintended inheritance and follows best practices for module classes that should not be extended.


23-24: Excellent security enhancement with #[SensitiveParameter].

The #[SensitiveParameter] attribute on the password parameter is a great security improvement that prevents sensitive data from being exposed in stack traces and debugging output.


37-38: Good explicit method override declaration.

The #[Override] attribute makes it clear that this method overrides a parent method, improving code clarity and enabling compile-time verification.

src/AuraSqlQueryInsertProvider.php (5)

9-9: Proper import for Override attribute.

The import statement correctly adds support for the #[Override] attribute used in this provider class.


14-14: Excellent use of final readonly class declaration.

Making the class final readonly provides both inheritance protection and immutability guarantees, which is perfect for provider classes that should be immutable value objects.


22-22: Correct property declaration for readonly classes.

Removing the explicit readonly keyword from the constructor parameter is the correct approach when the class is declared as readonly, as all properties become implicitly readonly. This avoids redundancy while maintaining immutability.


29-30: Good explicit interface method implementation.

The #[Override] attribute clearly indicates this method implements the ProviderInterface::get() method, improving code documentation and enabling compile-time verification.


32-32: Clean simplification of object instantiation.

Removing unnecessary parentheses from the QueryFactory instantiation improves code readability without changing functionality.

src/Pagerfanta/DefaultRouteGenerator.php (4)

7-7: Proper import for Override attribute.

The import statement correctly adds support for the #[Override] attribute used in this route generator class.


9-9: Excellent use of final readonly for route generator.

The final readonly declaration is perfect for this route generator class, ensuring immutability and preventing inheritance, which aligns with its purpose as a simple value object.


11-11: Correct property declaration consistency.

Removing the explicit readonly keyword from the constructor parameter is correct since the class is declared as readonly, making all properties implicitly readonly. This maintains consistency and avoids redundancy.


18-19: Good interface method documentation.

The #[Override] attribute on the __invoke method clearly indicates this implements the RouteGeneratorInterface::__invoke() method, improving code clarity and enabling compile-time verification of the interface contract.

src/Pagerfanta/FetchEntity.php (4)

8-8: Proper import for Override attribute.

The import statement correctly adds support for the #[Override] attribute used in this fetcher class.


14-14: Excellent immutability with final readonly declaration.

The final readonly class declaration is perfect for this entity fetcher, ensuring immutability and preventing inheritance, which is appropriate for this type of utility class.


16-16: Correct property declarations for readonly class.

Removing the explicit readonly keyword from both the $entity property and the $pdo constructor parameter is the correct approach when the class is declared as readonly. All properties become implicitly readonly, avoiding redundancy while maintaining the immutability guarantee.

Also applies to: 19-19


28-29: Good interface method documentation.

The #[Override] attribute on the __invoke method clearly indicates this implements the FetcherInterface::__invoke() method, improving code documentation and enabling compile-time verification of the interface implementation.

src/AuraSqlQueryUpdateProvider.php (5)

9-9: Good addition of Override import.

The import is correctly added to support the #[Override] attribute usage.


14-14: Excellent use of final readonly class declaration.

Making the class final readonly prevents inheritance and makes all properties implicitly readonly, which is a great improvement for immutability and type safety in PHP 8.4.


22-22: Correct removal of readonly from constructor parameter.

Since the class is now declared as readonly, all properties are implicitly readonly, so the explicit readonly modifier on the constructor parameter is redundant and correctly removed.


29-29: Proper use of #[Override] attribute.

The #[Override] attribute correctly indicates that this method implements the ProviderInterface::get() method, improving code clarity and enabling static analysis verification.


32-32: Good code style improvement.

Removing unnecessary parentheses around the new QueryFactory($this->db) expression improves readability.

src/AuraSqlQueryDeleteProvider.php (1)

9-32: Consistent and correct modernization.

All changes follow the same correct pattern as other provider classes:

  • final readonly class for immutability
  • Removal of redundant readonly from constructor parameter
  • Proper #[Override] attribute on interface method
  • Code style improvements

This consistency across provider classes is excellent.

src/AuraSqlQuerySelectProvider.php (1)

9-32: Good modernization with consistent pattern.

The changes correctly follow the same pattern as other provider classes with proper use of final readonly, #[Override], and constructor parameter adjustments.

src/Pagerfanta/AuraSqlPagerFactory.php (1)

8-25: Excellent modernization of factory class.

The changes correctly apply the same modernization pattern:

  • final readonly class for immutability and preventing inheritance
  • Proper removal of redundant readonly from constructor parameter
  • Correct #[Override] attribute on interface method implementation
  • Consistent with the pattern applied across other classes in this PR

The factory class is now properly modernized for PHP 8.4.

tests/Pagerfanta/AuraSqlPagerModuleTest.php (3)

7-7: LGTM: Proper import for PHP 8 PHPUnit attributes

Correctly imports the Depends attribute class to support the modernized dependency syntax.


18-18: LGTM: Code style improvement

The removal of unnecessary parentheses around new Injector(...) expressions improves code readability without affecting functionality.

Also applies to: 30-30, 103-103


41-41: LGTM: Modernized PHPUnit dependency attributes

Successfully migrated from deprecated PHPDoc @depends comments to PHP 8 #[Depends()] attributes. The dependency relationships are correctly preserved:

  • testArrayAccess and testArrayAccessWithMaxPage depend on testNewInstance
  • testArrayAccessWithBinding depends on testNewInstanceWithBinding

Also applies to: 61-61, 81-81

src/AuraSqlMasterDbInterceptor.php (5)

8-8: LGTM: Proper import for Override attribute

Correctly imports the Override attribute to support method override annotations.


13-13: LGTM: Enhanced immutability with final readonly class

Making the class final readonly prevents inheritance and ensures immutability, which is appropriate for this interceptor implementation.


15-15: LGTM: Typed constant improves type safety

Adding explicit string type to the constant enhances type safety. The static analysis warning about PHP 8.3+ requirement is not a concern since this PR targets PHP 8.4.

🧰 Tools
🪛 PHPStan (2.1.15)

15-15: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)


17-17: LGTM: Removed redundant readonly modifier

With the class declared as readonly, the readonly modifier on constructor parameters becomes redundant and is correctly removed.


24-24: LGTM: Proper Override attribute usage

The #[Override] attribute correctly documents that this method implements the MethodInterceptor interface.

src/AuraSqlConnectionInterceptor.php (5)

9-9: LGTM: Consistent Override import

Properly imports the Override attribute, maintaining consistency with other interceptor classes.


17-17: LGTM: Consistent final readonly pattern

Follows the same modernization pattern as other interceptor classes, enhancing immutability and preventing inheritance.


19-19: LGTM: Consistent typed constant

Matches the pattern used in other interceptor classes for type safety enhancement.

🧰 Tools
🪛 PHPStan (2.1.15)

19-19: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)


23-23: LGTM: Correct removal of redundant readonly modifiers

Both constructor parameters correctly have their readonly modifiers removed since the class-level readonly declaration makes them redundant.

Also applies to: 26-26


33-33: LGTM: Consistent Override attribute usage

Properly documents the interface method implementation, maintaining consistency across interceptor classes.

src/AuraSqlSlaveDbInterceptor.php (5)

8-8: LGTM: Consistent Override import

Maintains consistency with other interceptor classes in the modernization effort.


13-13: LGTM: Consistent final readonly implementation

Follows the established pattern for interceptor class modernization, enhancing immutability and preventing inheritance.


18-18: LGTM: Consistent typed constant pattern

Matches the type safety enhancement applied consistently across all interceptor classes.

🧰 Tools
🪛 PHPStan (2.1.15)

18-18: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)


20-20: LGTM: Correct readonly modifier removal

Properly removes the redundant readonly modifier from the constructor parameter, consistent with class-level readonly declaration.


27-27: LGTM: Proper Override attribute usage

Correctly documents the interface method implementation, completing the consistent modernization pattern across all interceptor classes.

src/Pagerfanta/AuraSqlPager.php (3)

8-8: Good addition of Override import for PHP 8.3+ compatibility.

The import is correctly added to support the #[Override] attributes used throughout the class.


21-21: Excellent modernization with final class declaration.

Making the class final follows modern PHP best practices and prevents unintended inheritance, which aligns with the immutable design pattern being adopted in this codebase.


49-50: Perfect implementation of #[Override] attributes.

All #[Override] attributes are correctly applied to methods that implement interface methods:

  • init() implements AuraSqlPagerInterface
  • offsetExists(), offsetGet(), offsetSet(), offsetUnset() implement ArrayAccess

This provides excellent documentation and compile-time verification of method overrides.

Also applies to: 63-65, 75-76, 101-102, 110-111

README.md (4)

5-5: Correct CI badge update for 2.x branch.

The continuous integration badge properly points to the 2.x branch, aligning with the new major version release.


9-13: Clear requirements specification for v2.x.

The requirements section clearly communicates the PHP ^8.4 and Aura.Sql ^6.0 dependencies, helping users understand the upgrade requirements.


22-30: Excellent version compatibility documentation.

The version compatibility table provides clear guidance for users on which versions to use based on their PHP version, with helpful branch links and status information.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~24-~24: A punctuation mark might be missing here.
Context: ...| PHP | Aura.Sql | Branch | Status | |---------|---------|----------|--------...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


136-136: Good fix for missing code block delimiter.

The addition of the closing ``` properly terminates the code block formatting.

src/Pagerfanta/AuraSqlQueryPagerFactory.php (3)

9-9: Proper Override import addition.

The import is correctly added to support the #[Override] attribute used on the newInstance method.


11-13: Excellent readonly class implementation.

The changes correctly implement a final readonly class:

  • final readonly prevents inheritance and makes all properties immutable
  • Removing readonly from the constructor parameter is correct since readonly classes automatically make all properties readonly
  • This modernizes the code to use PHP 8.2+ features effectively

20-21: Correct #[Override] usage for interface method.

The #[Override] attribute is properly applied to the newInstance method that implements the AuraSqlQueryPagerFactoryInterface.

src/TransactionalInterceptor.php (3)

8-8: Appropriate Override import for method annotation.

The import supports the #[Override] attribute used on the invoke method.


17-19: Consistent readonly class modernization.

The implementation follows the same excellent pattern as other classes in this PR:

  • final readonly class prevents inheritance and ensures immutability
  • Removing readonly from the constructor parameter is correct since readonly classes make all properties readonly automatically
  • This maintains functionality while leveraging PHP 8.2+ features

26-27: Proper #[Override] usage for interceptor method.

The #[Override] attribute correctly documents that the invoke method implements the MethodInterceptor interface, providing compile-time verification.

src/NamedPdoModule.php (5)

10-12: LGTM! Modern PHP imports added correctly.

The addition of Override and SensitiveParameter imports aligns with the PHP 8.4 modernization goals.


14-14: Excellent use of final keyword.

Making the module class final is a good practice that prevents unintended inheritance and improves code clarity in dependency injection contexts.


16-16: Good modernization with typed constant.

Adding explicit string type to the constant improves type safety and code clarity. The static analysis warning about PHP 8.3+ requirement is not a concern since this PR targets PHP 8.4.

🧰 Tools
🪛 PHPStan (2.1.15)

16-16: Class constants with native types are supported only on PHP 8.3 and later.

(classConstant.nativeTypeNotSupported)


31-32: Excellent security practice with SensitiveParameter.

The #[SensitiveParameter] attribute on the password parameter helps prevent accidental exposure in stack traces, logs, and debugging output - a crucial security enhancement.


43-44: Proper use of Override attribute.

The #[Override] attribute makes the inheritance intention explicit and will help catch errors if the parent method signature changes in the future.

UPGRADE.md (1)

1-91: Excellent comprehensive upgrade documentation.

This documentation effectively addresses all key concerns users might have about the v1.x to v2.x upgrade:

Strengths:

  • Clear explanation that no API changes were made despite major version bump
  • Comprehensive version compatibility matrix
  • Step-by-step migration guide
  • Helpful FAQ section addressing common concerns
  • Good technical context about PHP 8.4 PDO changes

The language tool suggestions are minor and don't impact the clarity or usefulness of the documentation.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~57-~57: A punctuation mark might be missing here.
Context: ...-----|-------------|----------|--------| | v1.x | ^8.1 | ^5.0...

(AI_EN_LECTOR_MISSING_PUNCTUATION)


[style] ~69-~69: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...* All public APIs and interfaces remain exactly the same. #### Q: Why the major version bump? *...

(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)


[style] ~86-~86: Consider using a different verb to strengthen your wording.
Context: ...ray-di/Ray.AuraSqlModule/issues) if you find any problems ### Technical Details Th...

(FIND_ENCOUNTER)


[uncategorized] ~90-~90: You might be missing the article “the” here.
Context: ...roduced in PHP 8.4. The underlying Aura.Sql library handles these changes transpare...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

src/Pagerfanta/AuraSqlQueryPager.php (3)

11-11: Proper import for Override attribute.

Good addition of the Override import to support the modernization efforts.


22-22: Appropriate use of final keyword.

Making this concrete pager implementation final prevents unintended inheritance and improves code clarity.


48-49: Excellent use of Override attributes on interface methods.

All interface methods (init, offsetGet, offsetExists, offsetSet, offsetUnset) are properly annotated with #[Override] attributes. This makes the interface implementation explicit and will help catch errors if interface signatures change.

Also applies to: 63-64, 96-97, 105-106, 114-115

src/Pagerfanta/ExtendedPdoAdapter.php (4)

8-8: Proper import for Override attribute.

Good addition of the Override import to support the interface method annotations.


28-28: Excellent use of readonly class feature.

The final readonly class declaration is a great use of PHP 8.4 features that makes all properties readonly automatically, improving immutability and type safety.


30-30: Correct property and constructor parameter handling for readonly class.

Since the class is declared readonly, individual properties don't need the readonly keyword and constructor parameters are automatically promoted to readonly properties. This is the correct approach for readonly classes.

Also applies to: 33-33


43-44: Proper Override annotations on interface methods.

The #[Override] attributes on getNbResults() and getSlice() methods correctly indicate these implement the AdapterInterface. This improves code clarity and helps catch interface changes.

Also applies to: 77-78

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @koriym - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Readonly class with mutable property assignment. (link)
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 4 other issues
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

koriym added 3 commits May 28, 2025 13:12
Replaced UPGRADE.md with a concise CHANGELOG.md to improve clarity and align with standard documentation practices. The changelog highlights the Aura.Sql dependency update for PHP 8.4 compatibility while noting no API or code changes are required.
Removed version compatibility details and outdated requirements. Streamlined the installation instructions to focus on the Composer command for clarity.
Standardized formatting for code examples, improved clarity of comments, and corrected typos such as "qaulifer" to "qualifier" and "iteratable" to "iterable". These updates enhance readability and maintain consistency throughout the documentation.
@koriym
Copy link
Member Author

koriym commented May 28, 2025

@coderabbitai review

Copy link

coderabbitai bot commented May 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (6)
README.md (6)

11-13: Ensure installation snippet is clear

The Bash snippet is properly fenced, but consider adding a brief descriptive comment so readers immediately know it’s for PHP 8.4+:

# Install the Aura SQL Module (requires PHP 8.4+)
composer require ray/aura-sql-module

33-36: Clarify placeholder variables in AuraSqlModule example

The example uses $options and $queries without defining them. To avoid confusion, include placeholder definitions before the install call:

$options = [];  // optional PDO driver options
$queries = [];  // optional post-connection queries

$this->install(
    new AuraSqlModule(
        'mysql:host=localhost;dbname=test',
        'username',
        'password',
        'slave1,slave2,slave3', // optional slave list
        $options,
        $queries
    )
);

45-55: Add context for $options and $queries in AuraSqlEnvModule

Similar to the direct module example, define or explain $options and $queries before use:

$options = [];  // optional PDO options
$queries = [];  // optional queries to run after connection

$this->install(
    new AuraSqlEnvModule(
        'PDO_DSN',
        'PDO_USER',
        'PDO_PASSWORD',
        'PDO_SLAVE',
        $options,
        $queries
    )
);

124-124: Refine wording for qualifier parameter

Small wording tweak for clarity:

-You can set `$qualifier` in 2nd parameter of AuraSqlReplicationModule.
+You can set the `$qualifier` via the second parameter of `AuraSqlReplicationModule`.

242-242: Convert emphasis to a subheading

Markdown lint flags bold text as a heading. Use a proper heading for “ExtendedPdo”:

-**ExtendedPdo**
+#### ExtendedPdo
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

242-242: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


266-266: Convert emphasis to a subheading

Similarly, change Select query builder to a heading:

-**Select query builder**
+#### Select query builder
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

266-266: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9096c27 and 6d10b73.

📒 Files selected for processing (1)
  • README.md (9 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~158-~158: A determiner appears to be missing. Consider inserting it.
Context: ...gres, SQLite, and Microsoft SQL Server. Following four interfaces are bound and can be in...

(AI_EN_LECTOR_MISSING_DETERMINER)

🪛 markdownlint-cli2 (0.17.2)
README.md

242-242: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


266-266: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🔇 Additional comments (2)
README.md (2)

105-105:

✅ Verification successful

Check NamedPdoModule constructor signature

Please verify that the constructor signature matches these parameters and order:

$this->install(new NamedPdoModule(
    'log_db',                            // qualifier
    'mysql:host=localhost;dbname=log',   // DSN
    'username',                          // user
    'password'                           // password
));

Run:

to confirm the constructor’s parameters.


🏁 Script executed:

rg -n "class NamedPdoModule" -n src

Length of output: 113


Let’s extract the constructor signature directly from the module:


🏁 Script executed:

#!/bin/bash
grep -R "function __construct" -n src/NamedPdoModule.php

Length of output: 94


Let’s pull the constructor parameters to verify their order:


🏁 Script executed:

#!/bin/bash
sed -n '27,40p' src/NamedPdoModule.php

Length of output: 468


Constructor signature matches invocation

The NamedPdoModule constructor is defined as:

  1. string $qualifer
  2. string $dsn
  3. string $username = ''
  4. string $password = ''
  5. $slave, $options, $queries (all with defaults)

Your README usage passes exactly the first four arguments in the correct order, so no changes are needed.


117-117:

✅ Verification successful

Verify NamedPdoEnvModule parameters

Likewise, ensure NamedPdoEnvModule accepts these env keys in order:

$this->install(new NamedPdoEnvModule(
    'log_db', 
    'LOG_DSN', 
    'LOG_USERNAME', 
    'LOG_PASSWORD'
));

Use:

to validate it.


🏁 Script executed:

rg -n "class NamedPdoEnvModule" -n src

Length of output: 122


🏁 Script executed:

#!/bin/bash
# Show the constructor signature of NamedPdoEnvModule to verify parameter order
rg -n "function __construct" -n src/NamedPdoEnvModule.php -A3 -B3

Length of output: 432


🏁 Script executed:

#!/bin/bash
# Display full constructor signature including all parameters
rg -n "public function __construct" -n src/NamedPdoEnvModule.php -A7 -B0

Length of output: 444


No changes needed for NamedPdoEnvModule parameters

The constructor signature in src/NamedPdoEnvModule.php is:

public function __construct(
    private readonly string $qualifer,
    private readonly string $dsn,
    private readonly string $username = '',
    private readonly string $password = '',
    private readonly string $slave    = '',
    private readonly array  $options  = [],
    private readonly array  $queries  = []
) { … }

Your call in README.md:

$this->install(new NamedPdoEnvModule(
    'log_db',
    'LOG_DSN',
    'LOG_USERNAME',
    'LOG_PASSWORD'
));

correctly maps to (qualifer, dsn, username, password) with all remaining parameters using their defaults. No update is required.

koriym added 5 commits May 28, 2025 15:18
This commit updates various dependencies in the `composer.lock` file for the vendor-bin tools, including version upgrades for `amphp/byte-stream`, `amphp/pipeline`, `doctrine/coding-standard`, `phpstan/phpdoc-parser`, and more. It also adds the new `danog/advanced-json-rpc` package and removes unused packages like `phpmd/phpmd` and `pdepend/pdepend`.
Added compatibility for Pagerfanta version 4.7 in composer.json while retaining support for version 3.5. This ensures the application can use newer features or improvements in the latest version without breaking compatibility.
Upgraded multiple dependencies, including `doctrine/coding-standard`, `pagerfanta/pagerfanta`, and `squizlabs/php_codesniffer`. Removed unused/unnecessary packages such as `phpmd/phpmd`, `pdepend/pdepend`, and `phpmetrics/phpmetrics`. Adjusted composer configuration to streamline plugin setup.
Replaced legacy annotation syntax with modern PHP attributes (`#[...]`) for `Named` and `Transactional` examples. This aligns the documentation with updated PHP standards and ensures consistency with current best practices.
Replaced incorrect or outdated PHP use imports in the README example. This ensures the code snippet aligns with the current implementation and avoids potential confusion for users.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
README.md (2)

5-5: Inconsistent badge versions
The Codecov and Type Coverage badges still point to branch 1.x while the CI badge now targets 2.x. Please update those badges to reference 2.x for consistency across the document.


62-65: Remove unused import and add missing Connection import
The snippet still imports AuraSqlConfig but never uses it, and Connection is unqualified when instantiating. Please remove the unused AuraSqlConfig import and add use Aura\Sql\Connection; to ensure the example compiles correctly.

🧹 Nitpick comments (8)
README.md (8)

33-36: Clarify placeholder variables in AuraSqlModule example
The $options and $queries variables are not defined in the snippet. Consider showing how to initialize or pass these (e.g. $options = [];) so readers know where they come from.


45-55: Clarify placeholder variables in AuraSqlEnvModule example
Similarly, $options and $queries appear without context. It may help to add a brief note or snippet demonstrating their initialization before installation.


89-90: Include import statements for #[Inject] and #[Named]
To make this example self-contained, add the relevant use statements (e.g., use Ray\Di\Annotation\Inject; and use Ray\AuraSqlModule\Annotation\Named;) before the method signature.


105-106: Add use NamedPdoModule import
The example instantiates NamedPdoModule but doesn’t show its import. Add use Ray\AuraSqlModule\NamedPdoModule; to the snippet for clarity.


117-118: Add use NamedPdoEnvModule import
Similarly, include use Ray\AuraSqlModule\NamedPdoEnvModule; so the code compiles as shown.


124-124: Rephrase replication qualifier note
Consider rewording for clarity, e.g.:

You can pass the $qualifier as the second argument to AuraSqlReplicationModule.


131-131: Fix indentation in replication-with-qualifier example
The $this->install line should be indented to match the surrounding block (e.g., 8 spaces) for consistency.


159-164: Add missing determiner
For grammatical correctness, insert “the” before “following”, e.g.:

The following four interfaces are bound and can be injected via constructor:

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 817e8a1 and 30ac750.

📒 Files selected for processing (1)
  • README.md (10 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~158-~158: A determiner appears to be missing. Consider inserting it.
Context: ...gres, SQLite, and Microsoft SQL Server. Following four interfaces are bound and can be in...

(AI_EN_LECTOR_MISSING_DETERMINER)

🪛 markdownlint-cli2 (0.17.2)
README.md

242-242: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


266-266: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🔇 Additional comments (5)
README.md (5)

11-13: Code block formatting for installation command
Great use of a fenced code block with the bash language specifier to highlight the installation steps.


15-15: Clear “Getting started” heading added
The new heading improves the structure and navigability of the README.


84-84: Attribute syntax for Named is correctly updated
Switching to #[Named($qualifier)] aligns the documentation with PHP 8 attribute usage.


138-138: Transactional attribute description
Switching to #[Transactional] for code examples aligns well with PHP 8 attribute usage.


148-149: Combined attributes are clear and concise
Using #[WriteConnection, Transactional] reduces clutter and modernizes the example.

Upgraded the PHPUnit schema URL from version 11.0 to 12.0 in the configuration file. This ensures compatibility with the latest PHPUnit features and standards. No other changes were made to the configuration.
@koriym
Copy link
Member Author

koriym commented May 28, 2025

@coderabbitai review

Copy link

coderabbitai bot commented May 28, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Removed the parentheses from the AuraSqlQueryConfig attribute to align with updated PHP attribute syntax. This change ensures compatibility and adheres to current standards.
@koriym
Copy link
Member Author

koriym commented May 28, 2025

@sourcery-ai review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
phpunit.xml.dist (1)

2-3: Schema version update addresses previous consistency concern.

The PHPUnit schema has been correctly updated to version 12.0, which aligns with the PHPUnit ^12.1 dependency mentioned in the PR objectives. This resolves the version inconsistency noted in previous reviews.

README.md (1)

3-5: Ensure badge consistency across all services
The CI badge has been updated to branch 2.x, but the Codecov (line 3) and Type Coverage (line 4) badges still reference branch 1.x. To keep versioning consistent, update those URLs to point to 2.x.

🧹 Nitpick comments (3)
README.md (3)

158-158: Grammar: missing determiner
Change “Following four interfaces” to “The following four interfaces” for grammatical correctness.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~158-~158: A determiner appears to be missing. Consider inserting it.
Context: ...gres, SQLite, and Microsoft SQL Server. Following four interfaces are bound and can be in...

(AI_EN_LECTOR_MISSING_DETERMINER)


242-242: Replace emphasis with heading
Line 242 uses * for a heading. Convert it to a proper Markdown # heading to satisfy lint rules.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

242-242: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


266-266: Replace emphasis with heading
Line 266 uses * for a heading. Use a Markdown heading prefix instead.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

266-266: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30ac750 and 5b79ff1.

📒 Files selected for processing (2)
  • README.md (10 hunks)
  • phpunit.xml.dist (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~158-~158: A determiner appears to be missing. Consider inserting it.
Context: ...gres, SQLite, and Microsoft SQL Server. Following four interfaces are bound and can be in...

(AI_EN_LECTOR_MISSING_DETERMINER)

🪛 markdownlint-cli2 (0.17.2)
README.md

242-242: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


266-266: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🔇 Additional comments (25)
phpunit.xml.dist (3)

4-5: Modern PHPUnit 12 configuration attributes properly applied.

The addition of requireCoverageMetadata="false" is appropriate for PHPUnit 12, which requires explicit declaration of coverage metadata handling. This helps maintain compatibility with the upgraded PHPUnit version.


6-10: Source configuration modernized for PHPUnit 12.

The explicit <source> element definition follows PHPUnit 12's recommended structure for defining code coverage scope. This replaces the older implicit configuration approach and provides clearer separation of concerns.


12-17: Coverage reporting configuration updated to PHPUnit 12 format.

The restructured <coverage> element with nested <report> elements follows the modern PHPUnit 12 XML schema. The configuration correctly defines both HTML and text output formats with appropriate destinations.

README.md (22)

11-13: Good: Added installation code fence
Using a fenced bash code block for the composer command improves readability.


33-36: Clarified optional constructor parameters
The inclusion of the slave list, driver options, and post-connection queries is clear and well-documented.


45-54: Documented environment-based module usage
The AuraSqlEnvModule example with environment variables and optional parameters is accurate and helpful.


62-75: Replication example updated for PHP 8.4
The new replication snippet correctly uses ConnectionLocator and demonstrates installing AuraSqlReplicationModule.


84-84: Modernized to PHP 8 attribute syntax
Switching from annotation to #[Named($qualifier)] aligns with the codebase modernization.


89-89: Example updated for named injection
The parameter-level #[Named('log_db')] attribute is correctly demonstrated.


105-105: NamedPdoModule usage documented
The NamedPdoModule example is clear and matches the updated API.


117-117: NamedPdoEnvModule usage documented
The environment-based named PDO example is correctly illustrated.


124-131: Qualifier parameter for replication documented
Demonstrating how to pass the $qualifier to AuraSqlReplicationModule is straightforward.


138-138: Transactional attribute description
The explanation for #[Transactional] is concise and accurate.


160-163: Query builder interface list
Listing each interface in bullet form is clear and matches the updated providers.


166-174: Constructor injection example
Using readonly properties and typed constructor parameters is correctly shown.


178-185: Select query builder example
The chainable builder methods are properly demonstrated with PHP 8 syntax.


205-209: Multiple query builders injection
The UserService constructor example correctly injects all four query interfaces.


214-220: createUser example
The insert workflow example aligns with the updated API.


224-233: updateUser example
The update workflow example is clear and accurate.


245-252: Pagination factory injection
Showing AuraSqlPagerFactoryInterface with typed readonly properties is accurate.


255-261: ExtendedPdo pagination example
The $pager = $pagerFactory->newInstance(...) usage is well-documented.


269-277: Select query pager factory injection
The AuraSqlQueryPagerFactoryInterface and SelectInterface injection example is correct.


283-290: getProductList example
The query pager usage with $select and dynamic URL is properly shown.


312-314: Iterable Page example
Demonstrating iteration over $page improves clarity on usage.


342-353: Profile module logger example
The anonymous class logger and AuraSqlProfileModule installation are correctly demonstrated.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @koriym - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Typed class constant is invalid (link)
  • Invalid RectorConfig method call (link)

General comments:

  • Typo in composer.json extra section: replace 'forwaard-command' with 'forward-command'.
  • Ensure that #[Override] and #[SensitiveParameter] attributes are imported from their proper namespaces (for example Ray\Aop\Annotation\Override or your module’s annotation namespace) rather than as bare use Override; statements.
  • Your rector.php config still defines PHPUnitSetList up to 11.0 even though you’ve bumped PHPUnit to ^12.1—either add the PHPUnit 12 set or remove the outdated sets to keep the modernisation config in sync.
Here's what I looked at during the review
  • 🔴 General issues: 2 blocking issues, 2 other issues
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

koriym and others added 2 commits May 28, 2025 20:20
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
The 'old_stable' field has been removed from the CI workflow configuration, leaving only the 'current_stable' version specified. This change streamlines the configuration to focus on the currently supported PHP version.
@koriym koriym merged commit 93745e0 into 1.x May 28, 2025
16 of 17 checks passed
@koriym koriym deleted the php8.4-tools branch May 28, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant